package com.runner.track;

import com.badlogic.gdx.math.Vector2;
import com.runner.entity.CollisionEntity;
import com.runner.player.Player;
import com.runner.utility.Locator;

public class NormalBlock extends Block{

	public NormalBlock(Vector2 pos) {
		super(pos, TYPE.BLOCK, BLOCK_STONE_PATH, SCALE);
	}
	
	public void update(float delta){
		super.update(delta);
		if(!exists || physics.getBody().getPosition().x < -BLOCK_WIDTH * Locator.getxSpriteScale()){
			delete();
			exists=false;
		}
	}

	@Override
	public void collide(CollisionEntity otherBody) {
		if(otherBody.getPhysics().getType().equals(TYPE.PLAYER)){
			if(!((Player)otherBody).hasShield()){
				exists=false;
			}
		}
	}

}
